﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SEAM.Exception.Formatter
{
    public class HTMLExceptionFormatter : ExceptionFormatterBase
    {
        protected override string GetSection(string sectionName, IDictionary sectionInfo)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<table><tr><td colspan='2' class='title'>{0}</td></tr>", sectionName);

            foreach (object key in sectionInfo.Keys)
                sb.AppendFormat("<tr><td class='name'>{0}</td><td class='value'>{1}</td></tr>", key, sectionInfo[key]);

            sb.Append("</table>" + Environment.NewLine);
            return sb.ToString();
        }

        protected override string GetHeader()
        {
            return "<html><body>";
        }

        protected override string GetFooter()
        {
            return "</body></html>";
        }

        protected override string GetSectionSeparator()
        {
            return "<br /><br />";
        }

    }
}
